package com.briup.sms.service.impl;

import com.briup.sms.dao.UserMapper;
import com.briup.sms.entity.User;
import com.briup.sms.service.UserService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @Author :xuyang
 * @DateTime:2024/1/10 23:34
 * @Version :v1.0.0
 * ClassName:UserServiceImpl
 * Package  :com.briup.sms.service.impl
 * Description:TODO
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    UserMapper mapper;

    @Override
    public PageInfo<User> findUserInfo(String username, Integer pageSize, Integer pageNum) {
        List<User> List = mapper.findUserInfo(username);
        PageInfo<User> pageInfo = new PageInfo<>(List);
        return pageInfo;
    }

    @Override
    public void updateLock(Integer id) {
        //先查id对应的user对应的信息
        User user = mapper.findById(id);
        //禁用会员
        user.setIsLock(false);
        //更新会员对象信息
        mapper.updateUserLock(user);
    }

    @Override
    public void updateStart(Integer id) {
        //先查id对应的user对应的信息
        User user = mapper.findById(id);
        //禁用会员
        user.setIsLock(true);
        //更新会员对象信息
        mapper.updateUserLock(user);
    }

}
